import os
import sys

# Django settings for wms project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    ('ok49', 'ok4949@gmail.com'),
)

MANAGERS = ADMINS
'''
DATABASE_ENGINE = 'django.db.backends.sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'wms.db'             # Or path to database file if using sqlite3.
DATABASE_USER = 'wms'             # Not used with sqlite3.
DATABASE_PASSWORD = 'wms'         # Not used with sqlite3.
DATABASE_HOST = 'localhost'             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '3306'             # Set to empty string for default. Not used with sqlite3.
'''
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'wms.db',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
	
    }
}


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Asia/Seoul'
#TIME_ZONE = 'Asia/Seoul'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
#LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'en-us'


#print _('English')

ugettext = lambda s : s

LANGUAGES = (
    ('ko', ugettext('Korean')),
    ('us', ugettext('English')),
    ('ja', ugettext('Japanese')),
)
#LANGUAGES_BIDI = ("ko", "us")
#LANGUAGE_COOKIE_NAME = 'django_language'
LOCALE_PATHS = (
    'templates/locale',
)



SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
USE_L10N = True
USE_TZ = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
#MEDIA_ROOT = ''
#MEDIA_ROOT = '/resources/'


# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"

#STATIC_URL = '/site_media/'
#MEDIA_URL = '/site_media/media/'



MEDIA_ROOT = ''
MEDIA_URL = ''

STATIC_ROOT = ''
STATIC_URL = '/static/'

STATICFILES_DIRS = ()
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)


# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
#ADMIN_MEDIA_PREFIX = '/static/admin/' 

# Make this unique, and don't share it with anybody.
SECRET_KEY = '0^+o^8!g#zm5w!shiap@rcf6&m5ox*j)f1i426os)cd0p-)6cc'

# List of callables that know how to import templates from various sources.

TEMPLATE_LOADERS = (
    #'django.template.loaders.filesystem.load_template_source',
    #'django.template.loaders.app_directories.load_template_source',
    #'django.template.loaders.eggs.load_template_source',
)
if DEBUG:
    TEMPLATE_LOADERS = [
	'django.template.loaders.filesystem.Loader',
	'django.template.loaders.app_directories.Loader',
	
    ]
else:
    TEMPLATE_LOADERS = [
        ('django.template.loaders.cached.Loader',(
		'django.template.loaders.filesystem.Loader',
		'django.template.loaders.app_directories.Loader',
		'forum.modules.template_loader.module_templates_loader',
		'forum.skins.load_template_source',
            )
	 ),
    ]



MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'middleware.LocaleMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.media",
    'django.core.context_processors.request',
    "django.core.context_processors.i18n",
    'django.core.context_processors.tz',
    'django.contrib.messages.context_processors.messages',
    
)



ROOT_URLCONF = 'urls'

WSGI_APPLICATION = 'wsgi.application'


TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(os.path.dirname(__file__), 'templates'),
	'/usr/lib/pymodules/python2.7/djblets/datagrid/templates'
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.staticfiles',
	
    'record',
    'master',
    'worksheet',
    
    
    'rest',
    'rest_framework',
    'rest_framework.authtoken',
)

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES':(
	'rest_framework.authentication.BasicAuthentication',
	'rest_framework.authentication.SessionAuthentication',
	#'rest_framework.authentication.TokenAuthentication',
    )
}



LOGIN_URL = '/login'

APPEND_SLASH=True
'''
import logging
logging.basicConfig(
        level=logging.DEBUG,
        format = '[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s',
    )
'''


AUTH_PROFILE_MODULE = 'master.UserProfiles'
                                     




LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },'simple': {
            'format': '%(levelname)s %(message)s'
        },'console':{
			'format':'[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s'
		}
    },
    'handlers': {
        'null': {
            'level':'DEBUG',
            'class':'django.utils.log.NullHandler',
        },
        'console':{
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'console'
        },
        'log_file':{
            'level': 'DEBUG',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': 'django.log',
            'maxBytes': '16777216', # 16megabytes
            'formatter': 'verbose'
        },
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler',
            'include_html': True,
        }
    },
    'loggers': {
        'django.request': {
            #'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
        'master': { # I keep all my apps here, but you can also add them one by one
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
    }
}


EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.myopera.com'
EMAIL_HOST_USER = 'ok49@myopera.com'
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 587



FILE_UPLOAD_HANDLERS=("django.core.files.uploadhandler.MemoryFileUploadHandler",
					  "django.core.files.uploadhandler.TemporaryFileUploadHandler",)
	



